﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using l1cs.server.model.Instance;
using l1cs.server.serverpackets;

namespace l1cs.server.model.monitor
{
    public class L1PcExpMonitor : L1PcMonitor
    {
        private int _old_lawful;

        private int _old_exp;

        public L1PcExpMonitor( object oId ) : base( Convert.ToInt32( oId ) ) { }

        public override void execTask( L1PcInstance pc )
        {
            // ロウフルが変わった場合はS_Lawfulを送信
            // // ただし色が変わらない場合は送信しない
            // if (_old_lawful != pc.getLawful()
            // && !((IntRange.includes(_old_lawful, 9000, 32767) && IntRange
            // .includes(pc.getLawful(), 9000, 32767)) || (IntRange
            // .includes(_old_lawful, -32768, -2000) && IntRange
            // .includes(pc.getLawful(), -32768, -2000)))) {
            if ( _old_lawful != pc.getLawful() )
            {
                _old_lawful = pc.getLawful();
                S_Lawful s_lawful = new S_Lawful( pc.getId(), _old_lawful );
                pc.sendPackets( s_lawful );
                pc.broadcastPacket( s_lawful );
            }

            if ( _old_exp != pc.getExp() )
            {
                _old_exp = pc.getExp();
                pc.onChangeExp();
            }
        }
    }
}
